package ffdata.inserting;

import java.util.List;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import ffdata.utils.FileUtils;
import ffmvc.model.JSONHolder;
import ffmvc.model.JdbcDataAccess;

public class InsertingMain {

	public static void main(String[] args) {

		// open/read the application context file
		ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("/spring/springStandalone.xml");
		JdbcDataAccess dataAccess = (JdbcDataAccess) ctx.getBean("dataAccess");

		List<JSONHolder> holders = FileUtils.loadScrapings();
		dataAccess.insertPlayers(holders);
		dataAccess.insertTeams(holders);
		dataAccess.insertGames(holders);
		//dataAccess.insertPerformances(holders);
		ctx.close();

	}

}
